<template>
  <div class="card-item flex">
    <a :href="item.content.source_link" target="_blank" v-if="item.content.cover" class="card-cover"><img :src="item.content.cover" alt="图片加载失败"></a>
    <div class="card-msg">
      <a :href="item.content.source_link" target="_blank" class="card-title">{{item.content.title}}</a>
      <div class="card-content-box">
        <span class="card-content">{{item.content.summary}}</span>
      </div>
      <div class="card-foot">
        <span class="data">{{item.content.date | time}}</span>
        <span class="vertical-bar" v-if="item.content.source"></span>
        <span class="source" v-if="item.content.source">{{item.content.source}}</span>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'search-news',
    props: ['item']
  }
</script>

<style lang="scss">
  .card-item {
    width: 648px;
    padding: 20px 18px;
    margin: 20px auto;
    border: 1px solid #f0f0f0;
    overflow: hidden;
    .card-cover {
      margin-right: 20px;
      width: 180px;
      height: 135px;
      overflow: hidden;
      cursor: pointer;
      &:hover img {
        transform: scale(1.07);
      }
      img {
        text-align: center;
        font-size: 14px;
        line-height: 135px;
        color: #00ba91;
        width: 100%;
        height: 100%;
        transition: .7s;
      }
    }
    .card-msg {
      position: relative;
      flex: 1;
      .card-title {
        display: block;
        font-weight: 400;
        font-size: 18px;
        margin-bottom: 8px;
        color: #33383e;
        display: -webkit-box;
        /*! autoprefixer: off */
        -webkit-box-orient: vertical;
        /* autoprefixer: on */
        -webkit-line-clamp: 2;
        overflow: hidden;
        cursor: pointer;
        &:hover {
          color: #00ba91;
        }
      }
      .card-content-box {
        .card-content {
          display: block;
          font-size: 14px;
          line-height: 1.5;
          color: #878787;
          transition: all ease-in-out .5s;
          display: -webkit-box;
          /*! autoprefixer: off */
          -webkit-box-orient: vertical;
          /* autoprefixer: on */
          -webkit-line-clamp: 3;
          overflow: hidden;
          margin-bottom: 25px;
        }
        .read-more {
          display: inline-block;
          font-size: 13px;
          color: #1b1d21;
          letter-spacing: .2px;
          cursor: pointer;
          &:hover {
            color: #00ba91;
          }
        }
      }
      .card-foot {
        display: flex;
        position: absolute;
        bottom: 0;
        .data {
          font-size: 12px;
          color: #aaaaaa;
        }
        .vertical-bar {
          display: block;
          width: 1px;
          height: 13px;
          background: #aaaaaa;
          margin: 0 10px;
        }
        .source-img {
          width: 12px;
          height: 12px;
          background: black;
        }
        .source {
          font-size: 12px;
          color: #aaaaaa;
        }
      }
    }
    &:hover{
      background: #f6f8fa;
    }
  }
</style>

